Release 10.1A: OpenEdge Development:
ProDataSets
Successive loading of ProDataSet data
The following procedure shows how you can do an initial load of header information into a ProDataSet, let the user make a selection from those header rows, and then fill in detail for selected rows.
![]()
To update your code:
- To get started, copy the final version of
dsOrderWinUpd.wfrom Chapter 6, "Updating Data with ProDataSets," to a new procedure calledPickOrder.w.- Delete the
Ordertemp-table fill-ins from the window.- Define a browse for
ttOrderwith the columnsOrderNum,CustNum,SalesRep, andOrderDate. Name the new browseOrderBrowse.Remember that you can do this in the AppBuilder by selecting the Temp-Tables dummy database in the query builder for the browse. Since you copied the procedure from the earlier one, it has all the same temp-table definitions.
- Define new fill-ins called
iCustNum,daOrderDate, andcSalesRep.- Make the initial value of
daOrderDateblank (using the Unknown value (?)) so that it doesn’t display today’s date by default.An easy way to get the fill-ins to inherit the attributes of the fields they represent in
ttOrderis to go through these steps for each one.- Select the fill-in from the Palette and drop it onto the design window.
- Double-click on it to bring up its property sheet and choose the Database Field button:
.
- From the Field-Selector dialog box, select the field from the Temp-Tables database and
ttOrdertable, as shown:
![]()
- Make the field’s Control Type
Local Variable, as shown:
![]()
- Set the Object name in the property sheet to the variable name, such as
iCustNum.This creates a local variable definition with the same attributes for label, format, and so forth as the temp-table field, but does not actually define the fill-in as the temp-table field. This is because you won’t use these fill-ins to display fields from the current
ttOrder, but rather to enter filter criteria for retrievingOrders through the ProDataSet.You will use these fill-ins to allow the user to filter
Orders by entering a value into one or more of the fields. The window procedure will request adsOrderProDataSet with all theOrders that satisfy the selection, and then allow the user to select anOrderand fetchOrderLinedetail for it.- Remove all the commented-out code from the
CHOOSE trigger for BtnSave. Change the statement at the end that re-enablediOrderNum(which is no longer there) to re-enable the three filter fields after aSavehas been processed:
- Change the
ROW-LEAVEtrigger code for theOlineBrowseto change the reference toiOrderNumto disable the three filter fields, in the same way as in Step 11:
At this point the window should look something like this:
![]()
Now you’re ready to start writing the support logic to retrieve data into the window.
- In the Definitions section, define a handle to hold the procedure handle of the procedure that contains the event logic and other support procedures for the data retrieval, as shown:
- In the Main Block, add a statement to kill this procedure when the window exits. For example:
- Add a statement to start it when the window starts up. For example:
The support procedure can be based on the procedure
OrderEvents.pthat you created earlier.- Copy
OrderEvents.ptoOrderSupport.p.- Remove the
INPUTparameter definitions fromOrderSupport.p.- Add variable definitions for a ProDataSet handle and a string to hold selection criteria. For example:
- Set the handle variable to the
dsOrderProDataSet handle and change theSET-CALLBACK-PROCEDUREreferences to the old input parameterphDataSetto behDataSet, as shown:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |